[HEADER]
	VERSION		00.00.00.00
	DESCRIPTION 
	COPYRIGHT	Imagination Technologies Ltd.
[/HEADER]

[VERTEXSHADER] 
	NAME 		MyVertexShader 

	[GLSL_CODE]

attribute mediump vec4	myVertex;
attribute mediump vec3	myNormal;
uniform mediump mat4	myWVPMatrix;
uniform mediump float	myAnim;
uniform mediump mat3	myWorldViewIT;
const vec3 LightPosition = vec3(0.0,4.0,0.0);
const vec3 SurfaceColor = vec3(0.7, 0.8, 0.4);
const float scaleIn = 1.0;
const float scaleOut = 0.1;
varying highp vec4 Color;

void main(void)
{
   
	vec3 normal = myNormal; 

	float ripple = 3.0*cos(0.2*myVertex.y + (radians(5.0*myAnim*360.0)));
	float ripple2 = -0.5*sin(0.2*myVertex.y + (radians(5.0*myAnim*360.0)));
	
	vec3 vertex = myVertex.xyz + vec3(0,0.0, ripple);
    gl_Position = myWVPMatrix * vec4(vertex,1.0);

	normal = normalize(myWorldViewIT * (myNormal + vec3(0,0.0, ripple2)) );
	
	vec3 position = vec3(myWVPMatrix * vec4(vertex,1.0));
    	vec3 lightVec   = vec3(0.0,0.0,1.0);
    
    float diffuse   = max(dot(lightVec, normal), 0.0);

    if (diffuse < 0.125)
         diffuse = 0.125;
         
    Color = vec4(SurfaceColor * diffuse * 1.5, 1.0);
 }

	[/GLSL_CODE]
[/VERTEXSHADER]
    
[FRAGMENTSHADER] 
	NAME 		MyFragmentShader 

	[GLSL_CODE]
varying highp vec4 Color;

void main (void)
{
    gl_FragColor = Color;
}
	[/GLSL_CODE]
[/FRAGMENTSHADER]
 
[EFFECT] 
	NAME 	myEffect
	ATTRIBUTE	myVertex		POSITION
	ATTRIBUTE	myNormal		NORMAL
	UNIFORM		myAnim			ANIMATION
	UNIFORM		myWorldViewIT	WORLDVIEWIT	
	UNIFORM		myWVPMatrix		WORLDVIEWPROJECTION
	
	VERTEXSHADER MyVertexShader
	FRAGMENTSHADER MyFragmentShader
[/EFFECT]
